﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data;
using System.Data.SqlClient;

/// <summary>
/// Summary description for ApplicationDAL
/// </summary>
public class ApplicationDAL
{
	public ApplicationDAL()
	{
		
	}

    public DataSet getApplicantList()
    {

        SqlConnection con = DBManager.getSqlConnection();

        String sql = "SELECT applicationId, CONVERT(Nvarchar(50),applicationDate,103) as applicationDate, custID, applyProduct, CASE productType WHEN 'H' THEN 'Hospitalisation' WHEN 'A' THEN 'Accident' END As productType FROM [APPLICATION_INSURANCE] WHERE ([applicationStatus] = @applicationStatus)";
        SqlCommand cmd = new SqlCommand(sql, con);
        cmd.Parameters.AddWithValue("@applicationStatus","PENDING");


        SqlDataAdapter myAdapter = new SqlDataAdapter(cmd);

        DataSet myDs = new DataSet();

        con.Open();
        myAdapter.Fill(myDs);

        con.Close();
        return myDs;
        


    }



}